#version 400 core

#define POSITION	0
#define VELOCITY	1
#define VERTEX		2
#define NORMAL	 	3
#define TEXCOORD 	4
#define FRAG_COLOR	0

layout(location = POSITION) in vec3 Position;
layout(location = VELOCITY) in vec3 Velocity;
layout(location = VERTEX) in vec3 Vertex;
layout(location = NORMAL) in vec3 Normal;
layout(location = TEXCOORD) in vec2 TexCoord;

uniform mat4 mvp;

out block
{
	smooth vec3 Color;
} Out;

void main()
{
    float r = float((gl_InstanceID * 37 & 0xF) + 5) / 20.0;
    float g = float(((gl_InstanceID * 73 >> 4) & 0xF) + 5) / 20.0;
    float b = float(((gl_InstanceID * 327 >> 8) & 0xF) + 5) / 20.0;

	gl_Position = mvp * (vec4(Vertex, 0.0) + vec4(Position, 1.0));
	Out.Color = vec3(r,g-(r/2),r-b);
}
